from django.shortcuts import render, HttpResponse


def home(request):
    return render(request, "web/muBan.html")


def news(request, nid):
    print(nid)
    page = request.GET.get("page")
    return HttpResponse("新闻")


def article(request):
    nid = request.GET.get("nid")
    print(nid)
    return HttpResponse("文章")


class Person(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def get_age(self):
        return self.age

    def get_dami(self):
        return '这是第一个类大咪大咪大咪'


def fetch_data():
    return '这是一个函数damidamidami(小写）'


def fetch_upper():
    return 'DAMIDAMI（大写）'


def auth(request):
    context = {
        'n1': '仙人掌',
        'n2': '刺头',
        'n3': [11, 22, 33, 44],

        'n4': {
            'name': '武佩奇',
            'age': 19,
        },
        'n5': [
            {'id': 1, 'name': '小咪', 'age': '18', },
            {'id': 2, 'name': '中咪', 'age': '28', },
            {'id': 3, 'name': '大咪', 'age': '38', },
            {'id': 4, 'name': '老咪', 'age': '48', },
        ],
        'n6': Person('大咪', 18),
        'n7': fetch_data(),
        'n8': fetch_upper()
    }
    return render(request, 'web/muBan.html', context)
